package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysPurposeMapper;
import com.ruoyi.system.domain.SysPurpose;
import com.ruoyi.system.service.ISysPurposeService;

/**
 * 用途信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-13
 */
@Service
public class SysPurposeServiceImpl implements ISysPurposeService 
{
    @Autowired
    private SysPurposeMapper sysPurposeMapper;

    /**
     * 查询用途信息
     * 
     * @param purposeId 用途信息主键
     * @return 用途信息
     */
    @Override
    public SysPurpose selectSysPurposeByPurposeId(Long purposeId)
    {
        return sysPurposeMapper.selectSysPurposeByPurposeId(purposeId);
    }

    /**
     * 查询用途信息列表
     * 
     * @param sysPurpose 用途信息
     * @return 用途信息
     */
    @Override
    public List<SysPurpose> selectSysPurposeList(SysPurpose sysPurpose)
    {
        return sysPurposeMapper.selectSysPurposeList(sysPurpose);
    }

    /**
     * 新增用途信息
     * 
     * @param sysPurpose 用途信息
     * @return 结果
     */
    @Override
    public int insertSysPurpose(SysPurpose sysPurpose)
    {
        sysPurpose.setCreateTime(DateUtils.getNowDate());
        return sysPurposeMapper.insertSysPurpose(sysPurpose);
    }

    /**
     * 修改用途信息
     * 
     * @param sysPurpose 用途信息
     * @return 结果
     */
    @Override
    public int updateSysPurpose(SysPurpose sysPurpose)
    {
        sysPurpose.setUpdateTime(DateUtils.getNowDate());
        return sysPurposeMapper.updateSysPurpose(sysPurpose);
    }

    /**
     * 批量删除用途信息
     * 
     * @param purposeIds 需要删除的用途信息主键
     * @return 结果
     */
    @Override
    public int deleteSysPurposeByPurposeIds(Long[] purposeIds)
    {
        return sysPurposeMapper.deleteSysPurposeByPurposeIds(purposeIds);
    }

    /**
     * 删除用途信息信息
     * 
     * @param purposeId 用途信息主键
     * @return 结果
     */
    @Override
    public int deleteSysPurposeByPurposeId(Long purposeId)
    {
        return sysPurposeMapper.deleteSysPurposeByPurposeId(purposeId);
    }

    @Override
    public List<SysPurpose> selectPurposeAll() {
        return sysPurposeMapper.selectPurposeAll();
    }

    @Override
    public List<Long> selectPurposeListByProductId(Long productId) {
        return sysPurposeMapper.selectPurposeListByProductId(productId);
    }
}
